package service

import (
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
	"zk2/product-guard/internal/dto"
	"zk2/product-guard/internal/model"
	"zk2/product-guard/response"
)

func UpdateAudit(c *gin.Context) {
	var shop model.Shop
	err := c.ShouldBind(&shop)
	if err != nil {
		response.Error(c, "参数错误")
		return
	}
	shop = model.Shop{
		Model: gorm.Model{
			ID: shop.ID,
		},
		Audit: shop.Audit,
	}
	err = dto.UpdateShop(&shop, int(shop.ID))
	if err != nil {
		response.Error(c, "审核状态修改失败")
		return
	}
	response.Success(c, "审核状态修改成功", shop.ID)
}
